<template>
	<view class="contain">
		<uni-forms style="margin: 10px;flex-wrap: nowrap;" ref="form"  v-model="formdata">
			<uni-forms-item label="访问名字" name="">
				<uni-easyinput   v-model="formdata.visitorName"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="手机号" name="">
				<uni-easyinput   v-model="formdata.phoneNumber"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="身份证" name="">
				<uni-easyinput   v-model="formdata.visitorIdNumber"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="被访问人名字" name="">
				<uni-easyinput   v-model="formdata.intervieweeName"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="被访问人手机号" name="">
				<uni-easyinput   v-model="formdata.intervieweePhoneNumber"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="预约时间" name="">
				<uni-easyinput   v-model="formdata.appointmentName"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="同行人" name="">
				<uni-easyinput   v-model="formdata.peer"></uni-easyinput>
			</uni-forms-item>
			<uni-forms-item label="车辆信息" name="">
				<uni-easyinput   v-model="formdata.vehicleInformation"></uni-easyinput>
			</uni-forms-item>
			
		</uni-forms>
		<button @click="save">保存</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				id:'',
				formdata:{
					visitorName:'',
					intervieweeName:'',
					phoneNumber:'',
					visitorIdNumber:'',
					intervieweePhoneNumber:'',
					appointmentName:'',
					intervieweePhoneNumber:'',
					vehicleInformation:'',
					peer:''
				}
				
			}
		},
		onLoad(e) {
			this.id=e.id
		},
		methods: {
			async save(){
				const res=await this.$request.addvisit(this.formdata)
				console.log(res)
				if(res.data.code==200){
					uni.showToast({
						icon:"success",
						title:res.data.msg,
						// complete:()=> {
							
						// title:res.msg,
					})
				}else{
					uni.showToast({
						icon:'error',
						title:res.data.msg
					})
				}
			}
			
		}
	}
</script>

<style>

</style>
